package me.helllp.book.jvm.ch02;

/**
 * 产生栈溢出
 * VM Args：-Xss128k
 * 
 * @author linxm
 *
 */
public class JavaVMStackOF {
    private static int stackLength = 1;
    
    public void stackLeak(){
        stackLength++;
        stackLeak();
    }
    
    public static void main(String[] args) throws Throwable{
        JavaVMStackOF oom = new JavaVMStackOF();
        
        try{
            oom.stackLeak();
        }catch(Throwable e){
            System.out.println("堆栈深度：" + stackLength);
            throw e;
        }
    }
}